import { withRouter } from 'next/router'
import React, { Component } from 'react'
import Head from 'next/head'
import { APPLICATION, LIFE_TXT } from '../../config/constant'
import MyLayout from '../../components/layout'
import MovieItem from './item'
import './index.module.less'
import Toolbars from './toolbars'
import { movieToolbar, gridList } from '../../config/movie.toolbar'
import { Tabs, Pagination, Radio } from 'antd'

const { TabPane } = Tabs;

class Note extends Component {
  constructor(props) {
    super(props)
    this.state = {
      defaultSort: 'hot'
    }
  }
  //分页
  onPageChange = (pageNumber) => {
    console.log('Page: ', pageNumber);
  }
  //排序
  onSortChange = e => {

  }

  render() {
    const { defaultSort } = this.state
    const { sort } = movieToolbar
    return (
      <div className="note_cont">
        <Head>
          <title>{APPLICATION}&raquo;{LIFE_TXT}</title>
        </Head>
        <MyLayout>
          <div className="container">
            <Tabs defaultActiveKey="1">
              <TabPane tab="电影" key="1">
                <Toolbars />
                <div className="sort_cont">
                  <Radio.Group onChange={this.onSortChange} value={defaultSort}>
                    {sort.map((item, index) => {
                      return <Radio value={item.value}>{item.name}</Radio>
                    })}
                  </Radio.Group>
                </div>
                <div className="gridview">
                  {
                    gridList.map((item, index) => {
                      return <MovieItem {...item} />
                    })
                  }
                </div>
                <Pagination showQuickJumper defaultCurrent={2} total={500} onChange={this.onPageChange} />
              </TabPane>
              <TabPane tab="Tab 2" key="2">
                Tab 2
              </TabPane>
              <TabPane tab="Tab 3" key="3">
                Tab 3
              </TabPane>
            </Tabs>
          </div>
        </MyLayout>
      </div>
    )
  }
}
export default withRouter(Note)